package ctbu.edu.cn.teachersjpa.controller;

import ctbu.edu.cn.teachersjpa.domain.Teachers;
import ctbu.edu.cn.teachersjpa.service.TeachersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TeacherController {
    @Autowired
    TeachersService teachersService;
    @RequestMapping("teachers/list")
    public String list(Model model){
        List<Teachers>teachers=teachersService.findAll();
        model.addAttribute("data",teachers);
        return "teachers/list";
    }
}
